package com.scu.bank.web;

import com.scu.bank.core.jo.Result;
import com.scu.bank.core.jo.ResultGenerator;
import com.scu.bank.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by pmeng on 2020/05/26.
 */
@RestController
@RequestMapping("/")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("login")
    public Result login(@RequestParam(required = true) String userName,@RequestParam(required = true) String cipher){
        return ResultGenerator.genSuccessResult(loginService.login(userName,cipher));
    }

    @GetMapping("getMenu")
    public Result getMenu(){
        return ResultGenerator.genSuccessResult(loginService.getMenu());
    }
}
